package tool.softT

import dao._
import implicits.Implicits._
import play.api.i18n.Messages
import shared.Pojo._
import tool.Pojo._
import shared.Pojo._
import tool.plot.{BorutaBox, SvmPlot}
import tool._
import utils.Utils

import java.io.File

/**
 * Created by yz on 7/12/2020
 */
trait BorutaSoftBT extends AllSoftBT with BorutaSoftT {

  override def getFileInfos(workspaceDir: File, index: Int)(implicit matrixFileDataDao: MatrixFileDataDao, messages: Messages): List[FileInfoData] = {
    List(
      FileInfoData("Decision_Boxplot.pdf", messages("decisionBoxplot")),
      FileInfoData("Decision_Info.csv", messages("decisionInfo")),
      FileInfoData("Diff_Metabolite.csv", messages("diffMetabolite")),
    )
  }

  override def getCommandData(workspaceDir: File, resultDir: File, index: Int): List[CommandData] = {
    val solutionFile = new File(Tool.dataDir, "color_solution/color_solution_1.txt")
    val rawDataFile = new File(workspaceDir, "AllMet_Raw.txt")
    val standardFile=new File(workspaceDir,"standard.txt")
    val command =
      s"""
         |${"Rscript".condaPath()} ${Tool.rPath.unixPath}/standard.R
         |${"Rscript".condaPath()} ${new File(Tool.rPath, "boruta.R").unixPath} --i ${standardFile.unixPath}
         |${"Rscript".condaPath()} ${new File(Tool.rPath, "boruta_plot.R").unixPath} --pc ${BorutaBox.configFileName}
         |convert  -density 300 Decision_Boxplot.pdf  Decision_Boxplot.png
           """.stripMargin
    List(CommandData(workspaceDir, List(command)))
  }

  override def producePlotConfigFile(workspaceDir: File, index: Int): Any = {
    Tool.producePlotConfigFile(AllPlotData(), BorutaBox, workspaceDir)
  }


}
